package main;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
public class SuRent extends JFrame implements MouseMotionListener,MouseListener{
    private JPanel contentPane;
    Button button = new Button();//
    Button button_1 = new Button();//         ߽
    public SuRent(int SumRent) {//SumRent Ϊ
        String Rent = Integer.toString(SumRent);
        setTitle("租用成功");
        setBackground(Color.white);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        setBounds(70,70, 510, 330);
        contentPane = new JPanel();
        contentPane.setBackground(Color.white);
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        setContentPane(contentPane);
        contentPane.setLayout(null);

        Label label = new Label("总共");
        label.setFont(new Font("Dialog", Font.PLAIN, 24));
        label.setBounds(90, 108, 132, 61);
        contentPane.add(label);

        Label label_1 = new Label("元");
        label_1.setFont(new Font("Dialog", Font.PLAIN, 24));
        label_1.setBounds(333, 108, 32, 61);
        contentPane.add(label_1);

        TextField textField = new TextField();
        textField.setFont(new Font("Dialog", Font.PLAIN, 24));
        textField.setBounds(228, 123, 99, 30);
        contentPane.add(textField);
        textField.setText(Rent);

        Label label_3 = new Label("租用确认提示");
        label_3.setAlignment(Label.CENTER);
        label_3.setBackground(Color.white);
        label_3.setFont(new Font("Dubai", Font.PLAIN, 30));
        label_3.setBounds(114, 24, 265, 45);
        contentPane.add(label_3);

        button.setLabel("上一步");
        button.setFont(new Font("Dialog", Font.PLAIN, 20));
        button.setBackground(Color.white);
        button.setBounds(40, 233, 106, 25);
        contentPane.add(button);
        button.addMouseListener(this);
        this.addMouseMotionListener(this);

        button_1.setLabel("确认");
        button_1.setFont(new Font("Dialog", Font.PLAIN, 20));
        button_1.setBackground(Color.white);
        button_1.setBounds(301, 233, 160, 25);
        contentPane.add(button_1);
        button_1.addMouseListener(this);
        this.addMouseMotionListener(this);
    }
    @Override
    public void mouseClicked(MouseEvent e) {
        if (e.getSource()== button){//
            setVisible(false);

            RentCar frame1 = new RentCar();
            frame1.setVisible(true);
        }
        if (e.getSource()== button_1){// ˳
            Customer frame = new Customer();
            frame.setVisible(true);//Customer

            setVisible(false);
        }
    }
    @Override
    public void mouseEntered(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
    @Override
    public void mouseExited(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
    @Override
    public void mousePressed(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
    @Override
    public void mouseReleased(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
    @Override
    public void mouseDragged(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
    @Override
    public void mouseMoved(MouseEvent arg0) {
        // TODO Auto-generated method stub
    }
}
